[iOS] How to catch cancallation of UIScrollView or others?
Posted
by
kyu
on Stack Overflow
See other posts from Stack Overflow
or by kyu
Published on 2011-01-01T02:33:20Z
Indexed on
2011/01/01
2:54 UTC
Read the original article
Hit count: 177
Sometimes, interruptions such as phone call occur and disturb a regular behavior of an app in iPhone or iPad.
For example, I created one UIScrollView instance and implemented UIScrollView delegate methods: scrollViewWillBeginDragging and scrollViewDidEndDragging(and scrollViewDidEndDecelerating).
A scrollViewWillBeginDragging method deactivated all custom buttons in my app. Then scrollViewDidEndDragging and scrollViewDidEndDecelerating methods activated these custom buttons. That is, while the user scrolled, all custom buttons became deactivated for a while.
The problem was that while the user started to drag and just held an UIScrollView instance, if I took a screenshot by pressing a home button and a power button, then any of scrollViewDidEndDragging and scrollViewDidEndDecelerating didn't get called. So the app became messed up.
I implemented a UIApplicationWillResignActiveNotification method in my UIViewController, but it didn't get called after taking a screenshot.
How can I catch any kind of interruption that disturbs a regular flow of events?
Sometimes, touchesEnd and touchesCanceled didn't get called too due to an interruption.
Thank you.
© Stack Overflow or respective owner